// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  //+ pnpm install sass -D
  //+ pnpm i @vueuse/core
  //+ pnpm install element-plus
  //+ pnpm install -D @element-plus/nuxt
  //+ pnpm install oh-vue-icons
  //+ npx nuxi module add color-mode
  //+ pnpm i -D @nuxtjs/tailwindcss
  //+ pnpm install @types/node
  //+ pnpm add dayjs lodash-unified
  
  compatibilityDate: '2024-04-03',
  routeRules:{},
  devtools: { enabled: false },
  experimental:{
    writeEarlyHints:false
  },
  // 暂时关闭有点问题
  // app: {
  //   pageTransition: { name: 'page', mode: 'out-in' }
  // },
  modules:['@vueuse/nuxt', "@element-plus/nuxt", '@nuxtjs/color-mode', '@nuxtjs/tailwindcss'],
  elementPlus:{},
  // 引入Element Plus 必需的CSS样式
  // '@/assets/css/colorScheme.scss'
  css:["element-plus/dist/index.css",
     'element-plus/theme-chalk/display.css',
     'element-plus/theme-chalk/dark/css-vars.css',
     '@/assets/css/universal.scss',
     '@/assets/css/colorScheme.scss'
    ],
  // 开启监听本机所有地址端口4000
  devServer:{host:"0.0.0.0",port:4000},
  // oh-vue-icons要用的
  build: {
    transpile: ['oh-vue-icons'],
    
  },
  // 运行时配置
  runtimeConfig:{
    public:{
    }
  },
  // 加载页面渲染模板
  spaLoadingTemplate:true,
  postcss:{
    plugins:{
      tailwindcss:{},
      autoprefixer:{}
    }
  },
  vite:{
    css:{
      preprocessorOptions: {
        scss: {
          api: "modern-compiler" // or 'modern'
        }
      }
    },
    ssr: {
      noExternal: ["oh-vue-icons"]
    },
    // 这里是Oh Vue Icons 要用的
    optimizeDeps: {
      exclude: ["oh-vue-icons/icons"],
    
    },
    // 只改 server 端构建 不配置这个页面跳转会出现问题
    $server: {                      
      build: {
        rollupOptions: {
          output: { preserveModules: false }
        }
      }
    }
  }
})
